package com.example.administrator.yunniuusedcar.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.example.administrator.common.base.BaseActivity;
import com.example.administrator.common.base.Global;
import com.example.administrator.yunniuusedcar.MainActivity;
import com.example.administrator.yunniuusedcar.R;
import com.example.administrator.yunniuusedcar.fragment.MineFragment5Model;
import com.example.administrator.yunniuusedcar.model.mode_benn.IHttpService;
import com.google.gson.Gson;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.Call;

/**   忘记密码  12.26 后台接口还没给出 （功能待完善）
 * Created by USER2015 on 2017/12/24.
 */

public class ForgetPasswordActivity extends BaseActivity {


    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.view7)
    View view7;
    @BindView(R.id.LL_title)
    RelativeLayout LLTitle;
    @BindView(R.id.et_iPhoneNum1)
    EditText etIPhoneNum1;
    @BindView(R.id.iv_YZMpager)
    ImageView ivYZMpager;
    @BindView(R.id.et_YanZhengCode1)
    EditText etYanZhengCode1;
    @BindView(R.id.btn_YZcode1)
    Button btnYZcode1;
    @BindView(R.id.et_LoginPassWords1)
    EditText etLoginPassWords1;
    @BindView(R.id.et_AgainLoginPassWords1)
    EditText etAgainLoginPassWords1;
    @BindView(R.id.btn_StartCompute1)
    Button btnStartCompute;
    private String userPhone;

    @Override
    public int getLayoutRes() {
        return R.layout.activity_forget_password;
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);

    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }

    @OnClick(R.id.btn_StartCompute1)
    public void onViewClicked() {
    }


    @OnClick({R.id.iv_back, R.id.btn_YZcode1, R.id.btn_StartCompute1})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.btn_YZcode1:  //短信验证
                break;
            case R.id.btn_StartCompute1: //修改并登陆
                if (!"".equals(etIPhoneNum1.getText().toString()) && !"".equals(etYanZhengCode1.getText().toString()) &&
                        !"".equals(etLoginPassWords1.getText().toString()) && !"".equals(etAgainLoginPassWords1.getText().toString().trim()))
                    ;
            {
                userPhone = etIPhoneNum1.getText().toString();
                String UserPhoneCode = etYanZhengCode1.getText().toString();
                String passWord = etLoginPassWords1.getText().toString();
                String againPassWord = etAgainLoginPassWords1.getText().toString();
                // ModifyLogin(userPhone, UserPhoneCode, passWord, againPassWord);
            }

            break;
        }
    }

//    private void ModifyLogin(String userPhone, String userPhoneCode, String passWord, String againPassWord) {
//        //   tTocken";    // 获取sign值
//
//        final String ul3 = IHttpService.HOST_URL + "Sign/getTocken";   // 忘记密码   （12.26后台接口还没出来，功能待完善！）Sign/getTocken
//
//        OkHttpUtils.post().url(ul3).addParams("tel_key", "33333333333333333").build().execute(new StringCallback() {     //.addParams("type","1")     222222222222222
//
//            @Override
//            public void onError(Call call, Exception e, int id) {
//                Global.showToast("请求超时！" + e.getMessage());
//                System.out.println("-----====----------A" + e);
//            }
//
//            @Override
//            public void onResponse(String response, int id) {
//                System.out.println("-----====----------A1" + response.toString());
//
//
//                TOKEN mTOKEN = new Gson().fromJson(response, TOKEN.class);
//
////                if (mTOKEN.getCode() == 1) {
////                    String ul = IHttpService.HOST_URL + "member/reg";   // 忘记密码
////
////                    // 以下是假数据 测试用
////                    OkHttpUtils.post().url(ul).addParams("sign", mTOKEN.getData()).addParams("phone", userPhone).addParams("password", password).build().execute(new StringCallback() {     //.addParams("type","1")
////
////                        @Override
////                        public void onError(Call call, Exception e, int id) {
////                            Global.showToast("请求超时！" + e.getMessage());
////                            System.out.println("-----====----------A" + e);
////                        }
////
////                        @Override
////                        public void onResponse(String response, int id) {
////
////
////                            System.out.println("-----====----------A" + response.toString());
////
////                            UP MUP = new Gson().fromJson(response, UP.class);
////                            if (MUP.getCode() == 1) {
////                                //登陆成功，跳转
//////                                Intent intent = new Intent(UserLoginActivity.this, MainActivity.class);
//////                                intent.putExtra("fragid",5);
//////                                android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//////                                transaction.replace(R.id.view_pager , new MineFragment5Model());
//////                                startActivity(intent);
//////
//////                                Toast.makeText(UserLoginActivity.this,"修改成功",Toast.LENGTH_SHORT).show();
////                            } else if (MUP.getCode() == 0) {
////                                //登录异常
////                                Global.showToast("获取数据失败");
////                            }else if (MUP.getCode() == 101) {
////                                Global.showToast("签名失效，请重新获取sing值");
////                            }
////
////                        }
////                    });
////
////                } else {
////                    //请求失败
////                }
////            }
//      });
//   }
//
//    }
}
